# -*- coding: utf-8 -*-

'''eof
name:申请人与企业负责人不一致
code:MG_Applicant_Not_LegalPerson
tableName:
columnName:
groups:烟商基本资质
dependencies:EG_LOAN
type:常用指标
datasourceType:在线指标
description:
eof'''


import sys
import pandas as pd
import datetime
import json

reload(sys)
sys.setdefaultencoding('utf-8')


def format_data():
    try:
        eg = json.loads(EG_LOAN[0]['data'])['content']['srcData'][0]['EG']
        jbxx = eg["results"][0]["jbxx"]
        return jbxx
    except:
        return [{}]


def MG_Applicant_Not_LegalPerson():
    null_type_list = ['', None, 'null', 'Null', 'NULL', '/', ' ']
    try:
        jbxx = format_data()
        if jbxx == [{}]:
            return u'缺失值'
        else:
            if jbxx.get("frname") not in null_type_list:
                if ratingRequest.get("borrowerName") != jbxx.get("frname"):
                    return 0
                else:
                    return 1
            else:
                return u'缺失值'
    except:
        return u'缺失值'


result = MG_Applicant_Not_LegalPerson()